package com.pengchuang.ACS.face.controller;

import java.util.Arrays;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.pengchuang.ACS.face.entity.CellEntity;
import com.pengchuang.ACS.face.service.CellService;
import com.pengchuang.ACS.common.utils.PageUtils;
import com.pengchuang.ACS.common.utils.R;

/**
 * 
 *
 * @author pengchaung
 * @email pengshi12138@outlook.com
 * @date 2023-03-16 21:25:07
 */

@RestController
@RequestMapping("/face/cell")
public class CellController {
    @Autowired
    private CellService cellService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = cellService.queryPage(params);

        return R.ok().put("result", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Integer id){
		CellEntity cell = cellService.getById(id);

        return R.ok().put("result", cell);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody CellEntity cell){
		cellService.saveOrUpdate(cell);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestParam Integer[] ids){
		cellService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
